package com.itheima.web;

import com.itheima.util.OssUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/*@Controller
@ResponseBody*/
@Controller
@RequestMapping("/file")
public class FileController {



    @PostMapping("/upload")
    @ResponseBody
    public String upload(MultipartFile uploadFile) throws IOException {
    String upload = OssUtil.upload(uploadFile.getOriginalFilename(), uploadFile.getInputStream());
        System.out.println("==============");
        System.out.println(upload);
    return upload;


}


}
